package com.bestcem.xm.om.dao;

import com.bestcem.xm.om.entity.OmPrincipal;

import java.util.List;
import java.util.Set;

/**
 * 描述信息
 *
 * @author xuan.yang <xuan.yang@idiaoyan.com>
 * @version v1.0
 * @date 2021/12/28 15:38
 */
public interface OmPrincipalDao {
    /**
     * findByOrgId
     * @param orgId
     * @return
     */
    List<OmPrincipal> findByOrgId(String orgId);

    /**
     * save
     * @param omPrincipal
     * @return
     */
    OmPrincipal save(OmPrincipal omPrincipal);

    /**
     * batchInsert
     * @param principals
     */
    void batchInsert(List<OmPrincipal> principals);

    /**
     * removeByOrgId
     * @param orgId
     * @return
     */
    Long removeByOrgId(String orgId);

    /**
     * findByName
     * @param name
     * @return
     */
    List<OmPrincipal> findByName(String name);

    /**
     * findByOmUserId
     * @param omUserId
     * @return
     */
    List<OmPrincipal> findByOmUserId(String omUserId);

    /**
     * 根据查询条件获取操作人列表
     *
     * @param principal
     * @return
     * @auther xuan.yang@idiaoyan.com
     * @date 2021/12/31 11:08
     */
    List<OmPrincipal> listByCondition(OmPrincipal principal);

    /**
     * 判断om用户是否有该机构的权限
     *
     * @param omUserId
     * @param orgId
     * @return boolean
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/1/18 17:39
     */
    boolean existsByOmUserIdAndOrgId(String omUserId, String orgId);

    /**
     * 根据orgid列表查询负责人信息
     *
     * @param orgIds
     * @return java.util.List<com.bestcem.xm.om.entity.OmPrincipal>
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/4/2 19:53
     */
    List<OmPrincipal> findPrincipalByOrgIds(Set<String> orgIds);

    /**
     * 查询公司id的负责人
     * 为空查询所有
     * @param orgIds
     * @return
     */
    Long countPrincipalByOrgIds(Set<String> orgIds);

    /**
     * listByOrgIds
     * @param orgIds
     * @return
     */
    List<OmPrincipal> listByOrgIds(List<String> orgIds);

    /**
     * pageByOrgIds
     * @param orgIds
     * @param currentPage
     * @param size
     * @return
     */
    List<OmPrincipal> pageByOrgIds(Set<String> orgIds, Integer currentPage, Integer size);

    /**
     * 根据负责人姓名查询机构id
     *
     * @param name
     * @return java.util.List<java.lang.String>
     * @author zhangfeng <feng.zhang@idiaoyan.com>
     * @date 2022/7/25 15:02
     */
    List<String> listOrgIdsByName(String name);
}
